Skip to content

test(workflow): fix child_process mock, add spawn export#710

Closed
agents-squads[bot] wants to merge 3 commits intodevelopfrom
fix/workflow-spawn-mock
Closed

test(workflow): fix child_process mock, add spawn export#710
agents-squads[bot] wants to merge 3 commits intodevelopfrom
fix/workflow-spawn-mock

Conversation

@agents-squads
Copy link
Copy Markdown
Contributor

@agents-squads agents-squads bot commented Mar 31, 2026

Fixes 6 failing tests in test/lib/workflow.test.ts (all runConversation tests).

Root cause: workflow rewrite (3956f75) switched from execSync to spawn but
vi.mock child_process factory did not export spawn, crashing every test
that reached runIndependentAgent.

Changes:

  • test/lib/workflow.test.ts: use importOriginal pattern, add makeFakeChild
    helper, replace mockExecSync with mockSpawn in 6 tests, capture prompts
    from stdin.write instead of execSync cmd arg
  • src/lib/workflow.ts: pass options.maxTurns || 100 to detectConvergence
    (was hardcoded 100, breaking the max-turns test)

All 16 workflow tests now pass. Unblocks PR 697 and release PR 696.

Jorge Vidaurre added 2 commits March 31, 2026 16:38
Instead of immediately launching autopilot, `squads run` now displays
all available agents grouped by squad with their roles and run hints.
Autopilot is still accessible via explicit intent flags (--once, -i,
--budget, --phased).

Closes #694
The workflow rewrite (3956f75) switched from execSync to spawn for
running agents, but the vi.mock factory in workflow.test.ts didn't
export spawn, crashing all runConversation tests.

Changes:
- Use importOriginal pattern in child_process mock so spawn is exported
- Add makeFakeChild() helper that emits stdout + close events async
- Replace mockExecSync calls with mockSpawn in 6 runConversation tests
- Capture prompts from stdin.write instead of execSync cmd arg
- Fix runConversation to pass options.maxTurns to detectConvergence
  (was hardcoded to 100, making the max-turns test fail)

Fixes 6 failing tests; all 16 workflow tests now pass.
…threshold

- Add 'review' and 'check' keywords to verifier classification in classifyAgent()
- Change compaction threshold from ≤6 to ≤5 turns
- Always preserve initial brief (first turn) in compacted transcripts

Fixes 3 failing tests in conversation.test.ts that were blocking CI across all open PRs.
@agents-squads agents-squads bot enabled auto-merge (squash) March 31, 2026 19:51
@agents-squads
Copy link
Copy Markdown
Contributor Author

agents-squads bot commented Apr 1, 2026

This PR has developed merge conflicts since it was opened. Needs rebase onto current main before it can merge.

Why this is urgent: #712 (squads log command) CI is failing because of missing spawn mock — this PR is the fix. #712 and #714 are MERGEABLE but BLOCKED on this. The v0.3.0 release (#696) is also blocked.

Please rebase and push — CI was green before the conflict.

@agents-squads
Copy link
Copy Markdown
Contributor Author

agents-squads bot commented Apr 1, 2026

Changes applied directly to develop (commit 8b71a6e). Closing redundant PR.

@agents-squads agents-squads bot closed this Apr 1, 2026
auto-merge was automatically disabled April 1, 2026 17:50

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants